package plugins;

import java.awt.Color;

import javax.swing.ImageIcon;

import framework.Framework;


import interfaces.Board;
import interfaces.State;
import interfaces.Visualizer;




public class SimpleVisualizer implements Visualizer{
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Framework fw = new Framework();
		fw.setVisualizer(new SimpleVisualizer());
		ConwayCell cell[][] = new ConwayCell[5][5];
		fw.intialstate(cell, 5, 5);
		fw.run();
	}
	
	// We aren't allowing for user customization in this example so this method is unused
	// Would normally adjust a hashtable or something
	public void setStateIcon(State state, ImageIcon icon){
		return;
	}
	
	// We aren't allowing for user customization in this example so this method is unused
	// Would normally adjust a hashtable or something
	public void setStateColor(State state, Color color){
		return;
	}
	
	@Override
	public void paint(Board board) {
		int x = board.getWidth();
		int y = board.getHeight();
		String tmp;
		for(int i = 0; i < x; i++){
			tmp = "|";
			for(int j = 0; j < y; j++){
				if(board.getCell(x,y).getState() instanceof DeadState) tmp = tmp + "X";
				else if(board.getCell(x,y).getState() instanceof ConwayCell) tmp = tmp + "O";
			}
			tmp = tmp + "|";
			System.out.println(tmp);
		}	
		System.out.println("-------");
	}
}